//
//  CellForNROfImg.m
//  HYHoney
//
//  Created by dllo on 16/2/28.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CellForNROfImg.h"
#import "ModelForPush.h"
#import "UIImageView+WebCache.h"
#import "DKNightVersionManager.h"
#import "DKNightVersion.h"

@interface CellForNROfImg ()

@property (nonatomic, retain)UIImageView *likeImg;

@end

@implementation CellForNROfImg

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        [self createVC];
    }
    return self;
}


- (void)dealloc{

    [_url release];
    [_like release];
    [_title2 release];
    [_imageNR release];
    [_likeImg release];
    [super dealloc];
}


- (void)createVC{
    
    self.url = [[NSString alloc] init];
    
    self.imageNR = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imageNR];
    
    self.title2 = [[UILabel alloc] init];
    [self.contentView addSubview:self.title2];
    
    self.like = [[UILabel alloc] init];
    [self.contentView addSubview:self.like];
    
    self.likeImg = [[UIImageView alloc] init];
    [self.like addSubview:self.likeImg];
    
}


- (void)layoutSubviews{
    
    [super layoutSubviews];
    
    self.imageNR.frame = CGRectMake(20, 20, self.contentView.frame.size.width - 40, self.frame.size.height - 60);
    self.imageNR.layer.cornerRadius = 8;
    self.imageNR.layer.masksToBounds = YES;
    
    self.title2.frame = CGRectMake(20, self.imageNR.frame.size.height + 18, self.contentView.frame.size.width - 60, 40);
    self.title2.font = [UIFont boldSystemFontOfSize:16];
    self.title2.numberOfLines = 0;
    

//    self.title2.textColor = [UIColor cyanColor];
//    self.title2.shadowColor = [UIColor whiteColor];
//    self.title2.shadowOffset = CGSizeMake(0.3, 0.5);
    
    self.like.frame = CGRectMake(self.frame.size.width / 4 * 3 - 20, 30, self.imageNR.frame.size.width / 4, 30);
    self.like.textColor = [UIColor whiteColor];
    self.like.backgroundColor = [UIColor blackColor];
    self.like.alpha = 0.6;
    self.like.layer.cornerRadius = 12;
    self.like.layer.masksToBounds = YES;
    
    self.likeImg.frame = CGRectMake(8, 3, self.like.frame.size.height - 6, self.like.frame.size.height - 6);

    
}


- (void)passModelPush:(ModelForPush *)model{
    
    [self.imageNR sd_setImageWithURL:[NSURL URLWithString:model.cover_image_url] placeholderImage:[UIImage imageNamed:@"jzz"]];
    
//    self.title2.text = model.title;
    self.title2.text = [NSString stringWithFormat:@"❀  %@",model.title];
    self.title2.dk_textColorPicker = DKColorWithRGB(0x000000, 0x87ceff);
    self.like.text = [NSString stringWithFormat:@"       %@",[model.likes_count stringValue]];
    
    self.likeImg.image = [UIImage imageNamed:@"xin.png"];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
